package util

import (
	"gin-wave-im/global"
	"github.com/go-playground/validator/v10"
)

func Error(err error) string {
	ret := ""
	if validationErrors,ok := err.(validator.ValidationErrors);!ok {
		return err.Error()
	} else {
		for _, e := range validationErrors {
			//log.Println(e.StructField())
			ret += e.Translate(global.GnTrans)+";"
		}
	}
	return ret
}
